gmx -quiet editconf -f complex.pdb -o CBz-HCD_2.gro -box 5.27 5.27 5.27
gmx -quiet solvate -cp CBz-HCD_2.gro -o CBz-HCD_2.gro -p CBz-HCD_2.top
gmx -quiet grompp -f em.mdp -po CBz-HCD_2_em.mdp -c CBz-HCD_2.gro -p CBz-HCD_2.top -o CBz-HCD_2_em.tpr  -maxwarn 1
gmx -quiet mdrun -deffnm CBz-HCD_2_em
echo q | gmx -quiet make_ndx -f CBz-HCD_2.gro -o CBz-HCD_2_index.ndx
gmx -quiet grompp -f nvt.mdp -po CBz-HCD_2_nvt.mdp -c CBz-HCD_2_em.gro -r CBz-HCD_2_em.gro -p CBz-HCD_2.top -o CBz-HCD_2_nvt.tpr -n CBz-HCD_2_index.ndx
gmx -quiet mdrun -deffnm CBz-HCD_2_nvt
gmx -quiet grompp -f npt.mdp -po CBz-HCD_2_npt.mdp -c CBz-HCD_2_nvt.gro -t CBz-HCD_2_nvt.cpt -r CBz-HCD_2_nvt.gro -p CBz-HCD_2.top -o CBz-HCD_2_npt.tpr -n CBz-HCD_2_index.ndx
gmx -quiet mdrun -deffnm CBz-HCD_2_npt
gmx -quiet grompp -f md.mdp -po CBz-HCD_2_md.mdp -c CBz-HCD_2_npt.gro -t CBz-HCD_2_npt.cpt -p CBz-HCD_2.top -o CBz-HCD_2_md.tpr -n CBz-HCD_2_index.ndx

gmx -quiet mdrun -deffnm CBz-HCD_2_md
for n in $(seq 2 10)
do
gmx -quiet convert-tpr -s CBz-HCD_2_md.tpr -extend 10000 -o CBz-HCD_2_md.tpr
gmx -quiet mdrun -deffnm CBz-HCD_2_md -cpi CBz-HCD_2_md.cpt
done

echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md.xtc -o CBz-HCD_2_md_c.xtc -center -pbc mol -n CBz-HCD_2_index.ndx -ur compact
echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md_c.xtc -o CBz-HCD_2_md_fit.xtc -n CBz-HCD_2_index.ndx -fit rot+trans
echo -e "2\n 1\n" | gmx -quiet trjconv -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md.gro -o CBz-HCD_2_md_f.gro -center -pbc mol -n CBz-HCD_2_index.ndx -ur compact
echo -e "1\n 1\n" | gmx -quiet rms -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md_fit.xtc -n CBz-HCD_2_index.ndx -o rmsd.xvg -m rmsd.xpm
echo -e "1\n 1\n" | gmx -quiet cluster -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md_fit.xtc -n CBz-HCD_2_index.ndx -dm rmsd.xpm -om rmsd-raw.xpm -o rmsd-clust.xpm -g cluster.log -clid clusters.xvg -cl clusters.pdb -cutoff 0.11
echo -e "2\n 3\n" | gmx -quiet hbond -s CBz-HCD_2_md.tpr -f CBz-HCD_2_md_fit.xtc -n CBz-HCD_2_index.ndx -num hbnum.xvg -hbm hbmap.xpm -hbn hbond.ndx
gmx_MMPBSA -nogui -i mmpbsa.in -cs CBz-HCD_2_md.tpr -ci CBz-HCD_2_index.ndx -cg 2 3 -ct CBz-HCD_2_md_fit.xtc -cp CBz-HCD_2.top -o CBz-HCD_2_GBSA.dat -eo CBz-HCD_2_GBSA.csv